package com.odp.controller;

import com.odp.entity.Code;
import com.odp.entity.Result;
import com.odp.entity.User;
import com.odp.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@CrossOrigin
@RestController
@RequestMapping("user")
public class UserController {
    @Autowired
    private UserService userService;

    @GetMapping
    public Result selectAll(){
        List<User> users = userService.selectAllService();
        return new Result(Code.SELECT_OK,"查询所有成功!",users);
    }
}